<?php

namespace App\Http\Controllers\Api\Wap\User;

use App\Http\Controllers\Common\ApiController;
use Illuminate\Http\Request;

class UserController extends ApiController{


    public function __construct() {
        $this->instance = new XXX();
    }

    public function lst(Request $request) {
        $page = $request->input('page',1);
        $pageSize = $request->input('pageSize',20);


        $conditions = $request->input();

        $records = $this->instance->getLst($conditions)->paginate($pageSize,$this->getCol,'page',$page);
        return responseSuccess($records->items(),$records->total());

    }

    public function add(Request $request) {
        $info = $request->input();

        $this->validate($request, [

        ],[],[

        ]);
        $record = $this->instance->updateOrCreate(['id'=>$info['id']??0],$info);
        return responseSuccess($record->toArray(),1);
    }
}
